package com.android.shop.ui;

import com.android.shop.R;
import com.android.shop.constant.MyConstantID;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class SettingActivity  extends BaseActivity {
	private LinearLayout update_version,leave_message,service_phone,our_introduce;
	private Button btn_loginout;
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.setting_layout);
		
		btn_loginout=(Button)this.findViewById(R.id.btn_loginout);
		btn_loginout.setOnClickListener(listener);
	}
	
	/*
	 * 退出登录
	 */
	public void loginout(){
		SharedPreferences.Editor sharedata =getSharedPreferences(MyConstantID.SP_NAME, Activity.MODE_PRIVATE).edit(); 
		sharedata.remove("loginname");
		sharedata.remove("expires");
		sharedata.remove("sellerid");
		sharedata.commit();
		Intent intent = new Intent();
		intent.setClass(SettingActivity.this, LoginActivity.class);
		startActivity(intent);
		finish();
	}
	
	View.OnClickListener listener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			switch(v.getId()){
			case R.id.update_version:
				break;
			case R.id.leave_message:
				break;
			case R.id.service_phone:
				break;
			case R.id.our_introduce:
				break;
			case R.id.btn_loginout:
				loginout();
				break;
			}
		}
		
	};
	
	public void back(View v){
		this.finish();
	}
}
